package crp.core.shared.config;

import crp.core.shared.Configs;
import org.eclipse.microprofile.config.inject.ConfigProperty;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Provider;
import java.util.Objects;

@ApplicationScoped
public class AppEnv implements Provider<String> {
    private final String value;

    @Inject
    public AppEnv(@ConfigProperty(name = Configs.KEY_APP_ENV) String value) {
        this.value = value;
    }

    @Override
    public String get() {
        return value;
    }

    public boolean isDefault() {
        return Objects.equals(Configs.DEFAULT_ENV, value);
    }
}
